using System;
using System.IO;
using System.Windows.Forms;
using LockImage.Gui;
using LockImage.Gui.Dialog;
using LockImage.Utils;

namespace LockImage
{
    static class MainApplication
    {
        public static String THIS_EXECUATABLE_NAME = Path.GetFileName(Application.ExecutablePath);
        public static String THIS_EXECUATABLE_FULL_PATH = Path.GetFullPath(Application.ExecutablePath);

        public static MainForm mainForm;

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MainApplication.initImage();
        }

        private static void initImage()
        {
            byte[] imageAsByteArray = ResourceManager.LoadResource(MainApplication.THIS_EXECUATABLE_FULL_PATH);
            if (null != imageAsByteArray)
            {
                Application.Run(new EnterPasswordDialog());
            }
            else
            {
                MainApplication.mainForm = new MainForm();
                Application.Run(MainApplication.mainForm);
            }
        }
    }
}